<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>02_JS运算符</title>
</head>
<body>
<script>
    console.log(6/3);//2
    console.log(3/2);//1.5

    //比较时,如有任意一边出现了数字,会隐式转为数字进行比较
    //如两边都是字符,比较的是字符的编码值
    //charCodeAt()查看字符编码,默认查看第一个字符,也可根据下标查看其它字符编码
    console.log(3>10);//false
    console.log(3>'10');//false
    console.log('3'>10);//false
    console.log('宇'>'博');//true
    console.log('宇'.charCodeAt());
    console.log('宇'.charCodeAt());
    console.log('博'.charCodeAt());
    console.log('3'>'10');//true 比较的是3和1的编码值
    console.log('3'.charCodeAt());//51
    console.log('103'.charCodeAt(2));//51

    let a = 1;
    let b = true;
    console.log(a==b); //松散比较运算符，true，1==1 只比较值
    console.log(a===b);//严格比较运算符，false，先比较数据类型，再比较值 number≠boolean

    //三元运算符 1 ? 2 : 3
    let c = 0;
    console.log(c == 0 ? 'true' : 'false'); //true
    console.log(c = 0 ? 'YES' : 'NO'); //'NO' =是赋值符号，变量c的值是0，转为布尔是false
</script>
</script>
</body>
</html>